package january4;

/**
 * ClassName: SumDigits
 * Package: january4
 * Description:求任意自然数各位数之和
 *
 * @Author fjorid
 * @Create 2025/1/4 19:53
 * @Version 1.0
 */
import java.util.Scanner;
public class SumDigits {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请任意输入一个自然数");
        int a=scanner.nextInt();
        int sum=0;
        while (a!=0){
            int x=a%10;
            sum=sum+x;
            a=a/10;
        }
        System.out.println(sum);

    }
}